<?php
require_once 'vendor/autoload.php';

// 初始化应用
$app = new \think\App();
$app->initialize();

use think\facade\Route;
use think\Request;

try {
    echo "测试订单API...\n";
    
    // 模拟GET请求到 /api/orders
    $request = Request::create('/api/orders', 'GET', [
        'page' => 1,
        'limit' => 5
    ]);
    
    // 获取路由
    $route = Route::rule('GET', 'api/orders', 'Order.OrderController/getOrderList');
    
    // 执行路由
    $response = $route->run($request);
    
    echo "API响应:\n";
    echo $response->getContent() . "\n";
    
} catch (Exception $e) {
    echo "错误: " . $e->getMessage() . "\n";
    echo "堆栈跟踪: " . $e->getTraceAsString() . "\n";
} 